﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Top.Core;
using Top.Web;

namespace Top.PointStore.LuckTurntable
{
    public static class LuckActivityManager
    {
        public static object ActivitySetting(int isOpen, string beginTime, string endTime, string exchangeBeginTime, string exchangeEndTime,int turnTime,int turnPoint)
        {
            Configs.AppSettings["BigTurnTableIsOpen"] = isOpen.ToString();
            Configs.AppSettings["BigTurnTableBeginTime"] = beginTime;
            Configs.AppSettings["BigTurnTableEndTime"] =Convert.ToDateTime(endTime).AddDays(1).ToString("yyyy-MM-dd");
            Configs.AppSettings["BigTurnTableBeginHour"] = exchangeBeginTime;
            Configs.AppSettings["BigTurnTableEndHour"] = exchangeEndTime;
            Configs.AppSettings["BigTurnTableTurnTime"] = turnTime.ToString();
            Configs.AppSettings["BigTurnTableTurnPoint"] = turnPoint.ToString();
            if (isOpen==1)
            {
                LuckBigWheel.Init();
            }
            return 1;
        }

        public static object ActivityGet()
        {
            string isOpen = Configs.AppSettings["BigTurnTableIsOpen"];
            string beginTime = Configs.AppSettings["BigTurnTableBeginTime"];
            string endTime = Convert.ToDateTime(Configs.AppSettings["BigTurnTableEndTime"]).AddDays(-1).ToString("yyyy-MM-dd");
            string exchangeBeginTime = Configs.AppSettings["BigTurnTableBeginHour"];
            string exchangeEndTime = Configs.AppSettings["BigTurnTableEndHour"];
            string turnTime = Configs.AppSettings["BigTurnTableTurnTime"];
            string turnPoint = Configs.AppSettings["BigTurnTableTurnPoint"];

            var obj = new
            {
                isOpen = isOpen,
                beginTime = beginTime,
                endTime = endTime,
                exchangeBeginTime = exchangeBeginTime,
                exchangeEndTime = exchangeEndTime,
                turnTime = turnTime,
                turnPoint = turnPoint
            };
            return obj;
        }
    }
}
